package net.webservice.server;

import net.webservice.Constants;
import net.webservice.entity.Message;

import javax.jws.WebService;

@WebService(serviceName = "MessageService",
        portName="MessageServicePort",
        endpointInterface = "net.webservice.server.MessageService",
        targetNamespace= Constants.SHAREDDATA_NAMESPACE,
        wsdlLocation = "WEB-INF/wsdl/MessageService.wsdl")
public class MessageServiceImpl implements MessageService{

    public Message getMessage(int id) {
        Message message = new Message();
        message.setId(id);
        message.setName("Message id: "+id);

        return message;
    }

    //don't use annotations here
    //public Message postMessage(@WebParam(name = "message") Message message) {
    public Message postMessage(Message message) {
        System.out.println(message.getName());
        return null;
    }
}
